<?php

namespace App\Containers\AppSection\File\Traits;

use App\Containers\AppSection\Authentication\Tasks\GetAuthenticatedUserTask;
use App\Containers\AppSection\File\Tasks\FindFileByIdTask;

trait IsOwnerTrait
{
    public function isOwner(): bool
    {
        $user = app(GetAuthenticatedUserTask::class)->run();
        $file = app(FindFileByIdTask::class)->run($this->id);

        return $user->id === $file->user->id;
    }
}
